package com.yusong.algorithm.link;

public class ListNodeUtil {


    public static ListNode create(int[] args){
        ListNode start = new ListNode(args[0]);
        ListNode pre = start;
        for(int index = 1; index < args.length; index++){
            pre.next = new ListNode(args[index]);
            pre = pre.next;
        }
        return start;
    }

    public static void printNode(ListNode node){
        StringBuffer sb = new StringBuffer();
        while (node != null){
            sb.append(node.val + "->");
            node = node.next;
        }
        sb.append("null");
        System.out.println(sb.toString());
    }

    public static void main(String[] args) {
        int[] data = {3,5};
        ListNode node = create(data);
        printNode(node);
    }


}
